﻿using System;
using UnityEngine;

// Token: 0x02000007 RID: 7
public class VoicePitchEx
{
	// Token: 0x06000013 RID: 19 RVA: 0x00003048 File Offset: 0x00001248
	static VoicePitchEx()
	{
		foreach (string text in Environment.CommandLine.Split(new char[]
		{
			' '
		}))
		{
			if (text != null && text.Contains("--pitchrate="))
			{
				string s = text.Substring("--pitchrate=".Length).Trim();
				try
				{
					float num = float.Parse(s);
					VoicePitchEx.SLIDER_DIFF *= num;
				}
				catch (Exception)
				{
				}
			}
		}
	}

	// Token: 0x06000014 RID: 20 RVA: 0x000030D8 File Offset: 0x000012D8
	public static float CalcVoicePitch(float sliderValue)
	{
		if (0f <= sliderValue && sliderValue < 1f)
		{
			return Mathf.Lerp(0.94f, 1.06f, sliderValue);
		}
		if (sliderValue < 0f)
		{
			return 0.94f - VoicePitchEx.SLIDER_DIFF * Mathf.Abs(sliderValue);
		}
		return 1.06f + VoicePitchEx.SLIDER_DIFF * Mathf.Abs(sliderValue - 1f);
	}

	// Token: 0x06000015 RID: 21 RVA: 0x00003139 File Offset: 0x00001339
	public static float CalcVoicePitchSliderValue(float min, float max, float voicePitch)
	{
		if (min <= voicePitch && voicePitch <= max)
		{
			return Mathf.InverseLerp(min, max, voicePitch);
		}
		if (voicePitch < min)
		{
			return (voicePitch - min) / VoicePitchEx.SLIDER_DIFF;
		}
		return (voicePitch - max) / VoicePitchEx.SLIDER_DIFF + 1f;
	}

	// Token: 0x0400000D RID: 13
	public static float SLIDER_DIFF = 0.12f;
}
